local awful = require("awful")
local gears = require("gears")
local dpi	= require("beautiful.xresources").apply_dpi


local theme = {}


local color = {}

--color.black   = "#1c1c1e"
--color.white   = "#f1f1f6" --"#f2f2f7"
--color.gray    = "#8d8d91" --"#8e8e93"
--color.gray2   = "#636365" --"#636366"
--color.gray3   = "#49494b" --"#48484a"
--color.gray4   = "#3c3c3e" --"#3a3a3c"
--color.gray5   = "#303031" --"#2c2c2e"
--color.gray6   = "#212123" --"#1c1c1e"
--color.gray7   = "#1c1c1e" --"#161618"
--color.red     = "#d65042" --"#ff453a"
--color.orange  = "#e3a034" --"#ff9f0a"
--color.yellow  = "#f0d63f" --"#ffd60a"
--color.green   = "#84d45a" --"#32d74b"
--color.mint	  = "#96d1cd" --"#66d4cf"
--color.teal    = "#90c1d9" --"#6ac4dc"
--color.cyan    = "#8cc5f0" --"#5ac8f5"
--color.blue    = "#5782f9" --"#0a84ff"
--color.indigo  = "#635cdf" --"#5e5ce6"
--color.purple  = "#a75eec" --"#bf5af2"
--color.pink    = "#d54561" --"#ff375f"
--color.brown   = "#a08d6b" --"#ac8e68"




color.base    = "#1e1d28"
color.surface = "#242231"
color.overlay = "#2a283b"
color.muted   = "#6d6a83"
color.subtle  = "#8e8ba7"
color.text    = "#dfddf2"
color.love    = "#cb7290"
color.gold    = "#e4c07d"
color.rose    = "#dbbbb9"
color.pine    = "#51728c"
color.foam    = "#aecdd6"
color.lris    = "#bba6e3"
color.hlow    = "#262531"
color.hmed    = "#413f52"
color.high    = "#525065"




local function opacity(v)
	return string.format("%02x", math.floor( 255 * v ))
end

local function icon(path, c)
	if c == nil then
		return os.getenv("HOME") .. "/.config/awesome/widgets/" .. path
	else
		return gears.color.recolor_image(os.getenv("HOME") .. "/.config/awesome/widgets/" .. path, c)
	end
end


---------------------------------------------------------------------------------------
------------------------------------- basic -------------------------------------------
---------------------------------------------------------------------------------------
theme.useless_gap                  = dpi(3.5)
theme.gap_single_client            = true
theme.border_width                 = dpi(2)
theme.border_rounded               = dpi(8)
theme.font				           = "Microsoft YaHei UI 9"
theme.fg                           = color.text
theme.bg                           = color.base
theme.border_normal                = color.overlay
theme.border_focus                 = color.foam
awful.mouse.snap.client_enabled    = true
awful.mouse.snap.edge_enabled      = false
awful.mouse.snap.default_distance  = dpi(5)
awful.mouse.snap.aerosnap_distance = dpi(5)
theme.snap_border_width            = dpi(2)
theme.snap_bg                      = color.lris
theme.snap_shape                   = gears.shape.rectangle
---------------------------------------------------------------------------------------
--------------------------------- topbar & widget -------------------------------------
---------------------------------------------------------------------------------------
theme.topbar_height                = dpi(33)
theme.topbar_fg 			       = color.text
theme.topbar_bg				       = ""
theme.widget_radius                = dpi(12)
theme.widget_fg                    = color.text
theme.widget_bg                    = ""
theme.widget_bg_hover              = ""
theme.widget_margins               = {top = dpi(3), bottom = dpi(3), left = dpi(0), right = dpi(0)}
theme.widget_icon_fg               = color.text
theme.widget_icon_bg_opacity       = 0.1
---------------------------------------------------------------------------------------
------------------------------------ popup --------------------------------------------
---------------------------------------------------------------------------------------
theme.popup_fg 			           = color.text
theme.popup_bg 			           = color.surface
theme.popup_border_radius          = dpi(0)
theme.popup_border_width           = dpi(2)
theme.popup_border_color           = color.overlay .. opacity(1)
theme.popup_margin_top	           = theme.topbar_height + theme.useless_gap * 2
theme.popup_margin_right           = theme.useless_gap * 2
---------------------------------------------------------------------------------------
--------------------------------- taglist ---------------------------------------------
---------------------------------------------------------------------------------------
theme.taglist_font                 = "Microsoft YaHei UI Bold 9"
theme.taglist_width        		   = dpi(28)
theme.taglist_spacing      		   = dpi(3)
theme.taglist_fg_focus     		   = color.base
theme.taglist_bg_focus     		   = color.foam
theme.taglist_fg_occupied  		   = color.text
theme.taglist_bg_occupied  		   = color.text .. opacity(0)
theme.taglist_fg_empty     		   = color.text .. opacity(0.1)
theme.taglist_bg_empty     		   = ""
theme.taglist_bg          		   = ""
theme.taglist_radius               = theme.widget_radius
---------------------------------------------------------------------------------------
---------------------------------- clock & calendar -----------------------------------
---------------------------------------------------------------------------------------
theme.clock_font	               = "Microsoft YaHei UI Bold 9"
theme.cal_font                     = "Microsoft YaHei UI 9"
theme.cal_header_fg                = color.text
theme.cal_weekday_fg               = color.love
theme.cal_fg_normal                = color.text
theme.cal_fg_focus                 = color.base
theme.cal_bg_focus                 = color.love
theme.cal_week_06_bg               = color.overlay
theme.cal_highlight_radius         = dpi(5)
theme.cal_default_padding          = {top = dpi(6), bottom = dpi(6), left = dpi(5), right = dpi(5)}
---------------------------------------------------------------------------------------
----------------------------------- volume --------------------------------------------
---------------------------------------------------------------------------------------
theme.vol_widget_font              = "Microsoft YaHei UI Bold 9"
theme.vol_device_title_font        = "Microsoft YaHei UI Bold 9"
theme.vol_device_content_font      = "Microsoft YaHei UI 9"
theme.vol_notify_font              = "Microsoft YaHei UI Bold 10"
theme.vol_device_sel_radius        = dpi(5)
theme.vol_widget_bar_fg            = color.text
theme.vol_widget_bar_mute_fg       = color.love
theme.vol_widget_bar_bg            = color.text .. opacity(0.1)
theme.vol_widget_bar_bg_hover      = color.text .. opacity(0.15)
theme.vol_sink_sel_bg              = color.overlay
theme.vol_sink_mute_line_bg        = color.love
theme.vol_sink_sel_line_bg         = color.foam
theme.vol_sink_unsel_line_bg       = ""
theme.vol_sink_unsel_bg            = ""
theme.vol_notify_bar_fg            = color.text
theme.vol_notify_bar_bg            = color.overlay
theme.vol_notify_bg                = theme.popup_bg
theme.vol_mute_icon		           = icon("volume/icons/vol_mute.svg" ,theme.widget_icon_fg)
theme.vol_bg_icon		           = icon("volume/icons/vol-bg.svg"   ,theme.widget_icon_fg)
theme.vol_100_icon		           = icon("volume/icons/vol-100.svg"  ,theme.widget_icon_fg)
theme.vol_70_icon		           = icon("volume/icons/vol-70.svg"   ,theme.widget_icon_fg)
theme.vol_40_icon		           = icon("volume/icons/vol-40.svg"   ,theme.widget_icon_fg)
theme.vol_10_icon		           = icon("volume/icons/vol-10.svg"   ,theme.widget_icon_fg)
theme.vol_speaker_icon	           = icon("volume/icons/speaker.svg"  ,theme.widget_icon_fg)
---------------------------------------------------------------------------------------
---------------------------------- wifi  ----------------------------------------------
---------------------------------------------------------------------------------------
theme.wifi_widget_font             = "Microsoft YaHei UI Bold 9"
theme.wifi_popup_device_font       = "Microsoft YaHei UI Bold 9"
theme.wifi_popup_opts_font         = "Microsoft YaHei UI Bold 8"
theme.wifi_popup_content_font      = "Microsoft YaHei UI 9"
theme.wifi_popup_bar_fg            = color.foam
theme.wifi_popup_bar_bg            = color.overlay
theme.wifi_popup_line_height       = dpi(24)
theme.wifi_signal_bg_icon		   = icon("wifi/icons/wifi-bg.svg" ,theme.widget_icon_fg)
theme.wifi_signal_0_icon		   = icon("wifi/icons/wifi-0.svg"  ,theme.widget_icon_fg)
theme.wifi_signal_1_icon		   = icon("wifi/icons/wifi-1.svg"  ,theme.widget_icon_fg)
theme.wifi_signal_2_icon		   = icon("wifi/icons/wifi-2.svg"  ,theme.widget_icon_fg)
theme.wifi_signal_3_icon		   = icon("wifi/icons/wifi-3.svg"  ,theme.widget_icon_fg)
---------------------------------------------------------------------------------------
----------------------------------- netspeed ------------------------------------------
---------------------------------------------------------------------------------------
theme.netspeed_up_icon			   = icon("netspeed/icons/netspeed-up.svg"          ,theme.widget_icon_fg)
theme.netspeed_up_active_icon	   = icon("netspeed/icons/netspeed-up-active.svg"   ,theme.widget_icon_fg)
theme.netspeed_down_icon		   = icon("netspeed/icons/netspeed-down.svg"        ,theme.widget_icon_fg)
theme.netspeed_down_active_icon	   = icon("netspeed/icons/netspeed-down-active.svg" ,theme.widget_icon_fg)
theme.netspeed_font                = "Terminus Bold 7"
---------------------------------------------------------------------------------------
----------------------------------- mem -----------------------------------------------
---------------------------------------------------------------------------------------
theme.mem_widget_graph_bg           = ""
theme.mem_widget_buffer_color       = color.text .. opacity(0.15)
theme.mem_widget_graph_border_width = dpi(1)
theme.mem_widget_graph_border_color = color.text .. opacity(0.5)
theme.mem_popup_graph_mask_img      = icon("mem/icons/mem_graph_mask.svg", color.base)
theme.mem_popup_graph_bg            = color.base
theme.mem_popup_graph_border_width  = dpi(0)
theme.mem_popup_graph_border_color  = ""
theme.mem_popup_buffer_color        = color.overlay
theme.mem_popup_title_font          = "Microsoft YaHei UI Bold 9"
theme.mem_popup_content_font        = "JetBrainsMono NFP 8.5"
theme.mem_graph_colors = {
	color.pine,
	color.pine,
	color.foam,
	color.foam,
	color.rose,
	color.rose,
	color.gold,
	color.gold,
	color.love,
	color.love,
}
---------------------------------------------------------------------------------------
----------------------------------- cpu -----------------------------------------------
---------------------------------------------------------------------------------------
theme.cpu_widget_graph_bg           = ""
theme.cpu_widget_graph_border_width = dpi(1)
theme.cpu_widget_graph_border_color = color.text .. opacity(0.5)
theme.cpu_popup_graph_mask_img      = icon("cpu/icons/cpu_graph_mask.svg", color.base)
theme.cpu_popup_graph_bg            = color.base
theme.cpu_popup_graph_border_width  = dpi(0)
theme.cpu_popup_graph_border_color  = ""
theme.cpu_popup_title_font          = "Microsoft YaHei UI Bold 9"
theme.cpu_popup_content_font        = "JetBrainsMono NFP 8.5"
theme.cpu_popup_bar_bg              = color.overlay
theme.cpu_graph_colors = {
	color.pine,
	color.pine,
	color.foam,
	color.foam,
	color.rose,
	color.rose,
	color.gold,
	color.gold,
	color.love,
	color.love,
}
theme.cpu_graph_colors[0] = color.pine
---------------------------------------------------------------------------------------
----------------------------------- promptbox -----------------------------------------
---------------------------------------------------------------------------------------
theme.prompt_font				= "JetBrainsMono NFP Bold 10"
theme.prompt_bg                 = theme.popup_bg
theme.prompt_fg                 = color.text
theme.prompt_border_width       = theme.popup_border_width
theme.prompt_border_color       = color.foam
theme.prompt_terminal_icon		= icon("promptbox/icons/terminal.svg", theme.widget_icon_fg)
---------------------------------------------------------------------------------------
----------------------------------- layoutbox -----------------------------------------
---------------------------------------------------------------------------------------
theme.layout_floating			= icon("layoutbox/icons/floating.svg"  , theme.widget_icon_fg)
theme.layout_max				= icon("layoutbox/icons/tilemax.svg"   , theme.widget_icon_fg)
theme.layout_tile				= icon("layoutbox/icons/tile.svg"      , theme.widget_icon_fg)
theme.layout_tileleft 			= icon("layoutbox/icons/tileleft.svg"  , theme.widget_icon_fg)
theme.layout_tilebottom			= icon("layoutbox/icons/tilebottom.svg", theme.widget_icon_fg)
theme.layout_tiletop			= icon("layoutbox/icons/tiletop.svg"   , theme.widget_icon_fg)
theme.layout_fairv				= icon("layoutbox/icons/fairv.svg"     , theme.widget_icon_fg)
theme.layout_fairh 				= icon("layoutbox/icons/fairh.svg"     , theme.widget_icon_fg)
---------------------------------------------------------------------------------------
--------------------------------- corner widget ---------------------------------------
---------------------------------------------------------------------------------------
--theme.corner_icon               = icon("corner/icons/corner.svg", color.base)
--theme.corner_size               = dpi(15)
---------------------------------------------------------------------------------------
--------------------------------- indicator -------------------------------------------
---------------------------------------------------------------------------------------
theme.indicator_floating_fg     = color.base
theme.indicator_floating_bg     = ""
theme.indicator_ontop_fg        = color.base
theme.indicator_ontop_bg        = ""
theme.indicator_sticky_fg       = color.base
theme.indicator_sticky_bg       = ""
theme.indicator_maximized_fg    = color.base
theme.indicator_maximized_bg    = ""
theme.indicator_font            = "Microsoft YaHei UI Bold 9"
theme.indicator_radius          = dpi(0)
theme.indicator_bg              = color.foam
theme.indicator_margins         = {top = dpi(0), bottom = dpi(0), left = dpi(12), right = dpi(0)}
---------------------------------------------------------------------------------------
--------------------------------- tasklist --------------------------------------------
---------------------------------------------------------------------------------------
--theme.icon_theme		         = "Fluent-dark"
--theme.tasklist_icon_size         = dpi(27)
--theme.tasklist_width        	 = dpi(33)
--theme.tasklist_spacing           = dpi(10)
--theme.tasklist_bg_focus          = ""
--theme.tasklist_bg_normal         = ""
--theme.tasklist_bg_minimize       = ""
---------------------------------------------------------------------------------------
-------------------------------------- disk -------------------------------------------
---------------------------------------------------------------------------------------
theme.disk_title_font            = "Microsoft YaHei UI Bold 9"
theme.disk_font                  = "Microsoft YaHei UI 9"
theme.disk_bold_font             = "Microsoft YaHei UI Bold 9"
theme.disk_part_bg_normal        = ""
theme.disk_part_bg_mounted       = color.overlay
theme.disk_bg_progressbar_normal = color.text .. opacity(0.05)
theme.disk_line_mounted_bg       = color.foam
theme.disk_line_unmounted_bg     = ""
theme.disk_button_bg             = color.overlay
theme.usb_icon					 = icon("disk/icons/usb.svg"   , theme.widget_icon_fg)
theme.disk_icon					 = icon("disk/icons/disk.svg"  , theme.widget_icon_fg)
theme.eject_icon				 = icon("disk/icons/eject.svg" , theme.widget_icon_fg)
theme.folder_icon                = icon("disk/icons/folder.svg", theme.widget_icon_fg)
theme.serial_icon				 = icon("disk/icons/serial.svg", theme.widget_icon_fg)
theme.disk_bar_colors = {
	color.pine,
	color.pine,
	color.foam,
	color.foam,
	color.rose,
	color.rose,
	color.gold,
	color.gold,
	color.love,
	color.love,
}
---------------------------------------------------------------------------------------
----------------------------------- music -----------------------------------------------
---------------------------------------------------------------------------------------
theme.music_title_font      = "Microsoft YaHei UI 10"
theme.music_artist_font     = "Microsoft YaHei UI 9"
theme.music_popup_width     = dpi(280)
theme.music_popup_height    = dpi(100)
theme.music_popup_margin    = dpi(0)
theme.music_icon            = icon("music/icons/music.svg"    )
theme.music_off_icon        = icon("music/icons/music-off.svg", theme.widget_icon_fg)
theme.music_next_icon       = icon("music/icons/next.svg"     )
theme.music_prev_icon       = icon("music/icons/prev.svg"     )
theme.music_play_icon       = icon("music/icons/play.svg"     )
theme.music_pause_icon      = icon("music/icons/pause.svg"    )
theme.music_cover_image     = icon("music/icons/cover.svg"    )
theme.music_blur_image      = icon("music/icons/blur.png"     )
theme.music_random_icon     = icon("music/icons/random.svg"   )
theme.music_repeat_icon     = icon("music/icons/repeat.svg"   )
theme.music_single_icon     = icon("music/icons/single.svg"   )
theme.music_icon_opacity    = 0.8
theme.music_title_opacity   = 0.8
theme.music_artist_opacity  = 0.5
theme.music_bg_opacity      = 0.2
theme.music_cover_round     = dpi(0)
theme.music_cover_margin    = dpi(0)
theme.music_notify_timeout  = 2
---------------------------------------------------------------------------------------
------------------------------------ weather ------------------------------------------
---------------------------------------------------------------------------------------
theme.weather_font	        = "Microsoft YaHei UI Bold 9"
---------------------------------------------------------------------------------------
--------------------------------- caps lock -------------------------------------------
---------------------------------------------------------------------------------------
theme.caps_on_icon          = icon("caps/icons/caps-on.svg", color.base)
theme.caps_widget_on_font   = "Microsoft YaHei UI Bold 9"
theme.caps_on_bg            = color.love
theme.caps_on_fg            = color.base
---------------------------------------------------------------------------------------
--------------------------------- taskpanel -------------------------------------------
---------------------------------------------------------------------------------------
theme.taskpanel_widget_bg      = color.text .. opacity(0.05)
theme.taskpanel_widget_bg_hover= color.text .. opacity(0.1)
theme.taskpanel_widget_line_bg = color.text .. opacity(0.1)
--theme.taskpanel_icon_path      = "~/.icons/Tela-circle/scalable/apps"
--theme.taskpanel_icon_path      = "~/.icons/WhiteSur/apps/scalable"
theme.taskpanel_icon_path      = "~/.icons/Colloid/apps/scalable"
theme.taskpanel_default_icon   = icon("taskpanel/icons/application-default-icon.svg")
theme.taskpanel_icon_size      = dpi(25)
theme.taskpanel_title_font     = "Microsoft YaHei UI Bold 9"
theme.taskpanel_title_fg       = color.text
theme.taskpanel_panel_margin   = {top = dpi(0), left = dpi( 5), right = dpi( 5), bottom = dpi(5)}
theme.taskpanel_title_margin   = {top = dpi(15),  left = dpi(15), right = dpi(0),  bottom = dpi(10)}
theme.taskpanel_list_margin    = {top = dpi(5),  left = dpi(0),  right = dpi(0),  bottom = dpi(0)}
theme.taskpanel_icon_margin    = {top = dpi(0),  left = dpi(7),  right = dpi(7),  bottom = dpi(0)}
theme.taskpanel_name_margin    = {top = dpi(0),  left = dpi(0),  right = dpi(5),  bottom = dpi(0)}
theme.taskpanel_list_font      = "Microsoft YaHei UI 9"
theme.taskpanel_list_height    = dpi(35)
theme.taskpanel_list_radius    = dpi(5)
--theme.taskpanel_height         = dpi(300)--2400 - theme.topbar_height - theme.useless_gap*4 - theme.border_width*2
theme.taskpanel_width          = dpi(370)
theme.taskpanel_fg             = color.text
theme.taskpanel_bg             = theme.popup_bg
theme.taskpanel_list_fg        = color.text
theme.taskpanel_list_bg        = ""
theme.taskpanel_list_curr_fg   = color.text
theme.taskpanel_list_curr_bg   = color.overlay
theme.taskpanel_list_mini_fg   = color.muted
theme.taskpanel_list_mini_bg   = ""
theme.taskpanel_list_line_bg   = color.foam
---------------------------------------------------------------------------------------
--------------------------------- smartbar --------------------------------------------
---------------------------------------------------------------------------------------
theme.handler_icon    		  = icon("handler/icons/handler.svg", color.base)
theme.handler_icon_size       = dpi(14)
theme.handler_icon_opacity    = 1
theme.handler_width           = dpi(100)
theme.handler_height          = dpi(14)
theme.handler_gap             = dpi(5)
theme.handler_trigger_range   = dpi(18)
theme.handler_border_radius   = dpi(15)
theme.handler_bg              = theme.border_focus
theme.handler_normal          = theme.border_focus
theme.handler_border_color    = theme.popup_border_color
theme.handler_border_width    = dpi(0)
theme.handler_timeout         = 3




return theme
